package com.ruoyi.system.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ruoyi.system.domain.Student;
import com.ruoyi.system.mapper.StudentMapper;
import com.ruoyi.system.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentServiceImpl implements StudentService {
    @Autowired
    private StudentMapper studentMapper;
    @Override
    public Integer inseart(Student student) {
        return studentMapper.inseart(student);
    }

    @Override
    public Integer delete(Integer id) {
        return studentMapper.delete(id);
    }

    @Override
    public Integer update(Student student) {
        return studentMapper.update(student);
    }

    @Override
    public PageInfo find(Integer pageNum,Integer pageSize) {
        //分页插件
        PageHelper.startPage(pageNum,pageSize);
        List<Student> students = studentMapper.find();
        //分页信息
        PageInfo pageInfo = new PageInfo(students);
        return pageInfo;
    }
}
